<template>
    <div>
        <el-dialog
                :title="img?`预览` : `提示`"
                :visible.sync="show"
                :width="img?`45%`:'30%'"
                :before-close="beforeClose"
        >
            <div>
                <div class="text-center" v-if="img">
                    <img :src="img" alt="">
                </div>

                <div v-else>{{content}}</div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="close">确 定</el-button>
            </span>
        </el-dialog>

    </div>
</template>

<script>
    export default {
        name: 'dialogzza',
        components: {},
        props: ['show', 'content', 'callback', 'img'],
        data() {
            return {}
        },
        computed: {},
        methods: {
            beforeClose(done) {
                done();
                this.callback(false)
            },
            close() {
                this.show = false;
                this.callback(true)
            }
        },
        mounted() {

        },
    }
</script>

<style lang="less" scoped>
    img {
        height: 400px;
        width: 100%;
        object-fit: contain;
    }
</style>
